package com.jdz.controller.backend;

import com.jdz.common.Const;
import com.jdz.common.ServerResponse;
import com.jdz.pojo.Announcemen;
import com.jdz.pojo.Group;
import com.jdz.service.IGroupService;
import com.jdz.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/manage/group")
public class GroupManageController {

    @Autowired
    IGroupService iGroupService;

    /**
     * 列出所有用户分组
     * @return
     */
    @RequestMapping(value = "list.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse list() {
        return iGroupService.list();
    }

    /**
     * 删除用户分组
     * @param groupno
     * @return
     */
    @RequestMapping(value = "delete.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse delete(Integer groupno) {
        return iGroupService.delete(groupno);
    }

    /**
     * 添加分组
     * @return
     */
    @RequestMapping(value = "add.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse add(Group group) {
        return iGroupService.add(group);
    }

    /**
     * 修改分组
     * @return
     */
    @RequestMapping(value = "update.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse update(Integer groupno,String groupname) {
        return iGroupService.update(groupno,groupname);
    }
}
